package leetcode;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

/**
 * ClassName: MeituanT1
 * Package: leetcode
 * Description:
 *
 * @Author wjn
 * @Create 2025/9/6 10:30
 * @Version 1.0
 */
public class MeituanT1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int n = s.length();
        int start = 0;
        Set<String> set = new HashSet<>();

        for (int i = 0; i < n - 1; i++) {
            if (s.charAt(i) == 'd' && s.charAt(i+1) == 'p') {
                String x = s.substring(start, i);
                set.add(x);
                start = i + 2;
            }
        }

        System.out.println(set.size());
    }
}
